<?php
class Newscategory_model extends MY_Model
{
    private $table = 'blues_news_category';
    public function __construct()
    {
        parent::__construct();
    }
    public function get_cat_by_id($id)
    {
        $this->db->where("cat_id",$id);
        $query=$this->db->get($this->table);
        return $query->row_array();
    }
   
    public function get_cat_list()
    {
        $where = "";
		$sql = "SELECT * FROM blues_news_category {$where} ORDER BY sort_order DESC,cat_id ASC";
		$query = $this->db->query($sql);
        return $query->result_array();        
    }

   
    public function add_cat($data)
    {
        $res= $this->db->insert($this->table,$data);
        if($res){
            return $this->db->insert_id();
        }
        return FALSE;
    }

    
    public function edit_cat($id,$data)
    {
        $this->db->where('cat_id',$id);
        return $this->db->update($this->table,$data);
    }        
    //删除分类
    public function del_cat($del_ids)
    {
		$sql = "DELETE FROM blues_news_category WHERE cat_id in ({$del_ids})";
		$query = $this->db->query($sql);
        return true;
    }
}

/* End of file flybird/orders_model.php */
/* Location: ./application/models/orders_model.php */